﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CB.Logic;
using Swift.Lib;
using Swift;

namespace CB.Client
{
    /// <summary>
    /// 主界面, 选择模式
    /// </summary>
    public class UIMain : UIContent
    {
        [SerializeField] private Button ColorModeBtn;
        [SerializeField] private Button ImageModeBtn;

        private void Awake()
        {
            ColorModeBtn.onClick.AddListener(SelColorMode);
            ImageModeBtn.onClick.AddListener(SelImageMode);
        }

        private void SelColorMode()
        {
            this.ShowTransit(() => 
            {
                GameManager.Instance.StartNewGame(GameMode.Color);
                var ui = UIManager.Instance.ShowUIContent<UIColorGame>(UIContentDefine.UIColorGame);
                ui.SetData();
                gameObject.SetActive(false);
            });
        }

        private void SelImageMode()
        {
            this.ShowTransit(() =>
            {
                GameManager.Instance.StartNewGame(GameMode.Image);
                var ui = UIManager.Instance.ShowUIContent<UIImageGame>(UIContentDefine.UIImageGame);
                ui.SetData();
                gameObject.SetActive(false);
            });            
        }
    }
}